package com.wenli.graduate2022.wenliGreenShop.service.servImpl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wenli.graduate2022.wenliGreenShop.entity.ProductOrder;
import com.wenli.graduate2022.wenliGreenShop.repository.mapper.ProductOrderMapper;
import com.wenli.graduate2022.wenliGreenShop.service.servDao.ProductOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author HuangHai
 * @date 2021/10/13 16:23
 */
@Service
public class ProductOrderServImpl implements ProductOrderService {

    @Autowired
    ProductOrderMapper productOrderMapper;

    @Override
    public List<ProductOrder> findByUserId(Integer id) {
        return productOrderMapper.findByUserId(id);
    }

    @Override
    public IPage<ProductOrder> findByPage(Page page) {
        return productOrderMapper.findByPage(page);   //倒序分页查询
    }

    @Override
    public IPage<ProductOrder> findByCode(Page page,String code) {
        return productOrderMapper.findByCode(page,code);
    }

    @Override
    public ProductOrder findByOrderId(Integer id) {
        return productOrderMapper.findByOrderId(id);
    }

    @Override
    public int updateStatus(String code) {
        return productOrderMapper.updateStatus(code);
    }

    @Override
    public int delete(Integer id) {
        return productOrderMapper.delete(id);
    }

    @Override
    public int insert(ProductOrder productOrder, String address, String userId) {
        return productOrderMapper.insert(productOrder, address, userId);
    }
}
